package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;


import com.dao.ChongdianzhuangbaoxiuDao;
import com.domain.entity.ChongdianzhuangbaoxiuEntity;
import com.service.ChongdianzhuangbaoxiuService;

@Service("chongdianzhuangbaoxiuService")
public class ChongdianzhuangbaoxiuServiceImpl extends ServiceImpl<ChongdianzhuangbaoxiuDao, ChongdianzhuangbaoxiuEntity> implements ChongdianzhuangbaoxiuService {

    @Autowired
    private ChongdianzhuangbaoxiuDao dao;

    @Override
    public PageUtils queryPage(int pageNum, int pageSize,ChongdianzhuangbaoxiuEntity chongdianzhuangbaoxiu) {

        EntityWrapper<ChongdianzhuangbaoxiuEntity> wrapper = new EntityWrapper<>();

        if (StringUtils.isNotEmpty(chongdianzhuangbaoxiu.getDianzhuangbianhao())){
            wrapper.like("dianzhuangbianhao", chongdianzhuangbaoxiu.getDianzhuangbianhao());
        }

        if (StringUtils.isNotEmpty(chongdianzhuangbaoxiu.getDianzhuangleibie())){
            wrapper.like("dianzhuangleibie", chongdianzhuangbaoxiu.getDianzhuangleibie());
        }

        if (StringUtils.isNotEmpty(chongdianzhuangbaoxiu.getSuochuweizhi())){
            wrapper.like("suochuweizhi", chongdianzhuangbaoxiu.getSuochuweizhi());
        }


        Page<ChongdianzhuangbaoxiuEntity> page = new Page<>();
        page.setRecords(dao.selectPage(page, wrapper));
        return new PageUtils(page);
    }

    @Override
    public void deleteByBianHao(String dianzhuangbianhao) {
        dao.deleteByBianHao(dianzhuangbianhao);
    }



}
